/*
 * tabeladordata.c
 *
 *  Created on: 24/02/2013
 *      Author: marcio
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>


int main(int arg, char* argvs[]){
	char* fileout = argvs[1];
	char* filein = argvs[2];
	char nameg[200];
	long i, mm, pf;
	float t, tm, tdv;
	FILE* res = fopen(fileout, "w");
	FILE* init = fopen(filein, "r");
	while(!feof(init)){
		tm = 0;
		for(i = 0; i < 5 && !feof(init); i++ ){
			fscanf(init, "%s", nameg);
			fscanf(init, "%f", &t);
			fscanf(init, "%lu", &mm);
			fscanf(init, "%lu", &pf);
			tm += t/5.0;
		}
		fprintf(res,"%s \t %f \t %lu \t %lu \n", nameg, tm, pf, mm);
		printf("%s \t %f \t %lu \t %lu \n", nameg, tm, pf, mm);
	}
	fclose(res);
	fclose(init);
	printf("FIM \n");
	return 0;
}

